package com.gel.shortLink.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gel.shortLink.admin.convention.result.Result;
import com.gel.shortLink.admin.convention.result.Results;
import com.gel.shortLink.admin.remote.dto.req.RecycleBinRecoverReqDTO;
import com.gel.shortLink.admin.remote.dto.req.RecycleBinRemoveReqDTO;
import com.gel.shortLink.admin.remote.dto.req.RecycleBinSaveReqDTO;
import com.gel.shortLink.admin.remote.dto.req.RecyclePageReqDTO;
import com.gel.shortLink.admin.remote.dto.resp.ShortLinkPageRespDTO;
import com.gel.shortLink.admin.remote.service.ShortLinkRemoteService;
import com.gel.shortLink.admin.service.RecycleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/short-link/admin/link/recycle")
@RequiredArgsConstructor
public class RecycleController {
    private final RecycleService recycleService;
    private final ShortLinkRemoteService shortLinkRemoteService=new ShortLinkRemoteService() {
    };
    /*保存至回收站*/
    @PostMapping("/save")
    public Result<Void> save(@RequestBody RecycleBinSaveReqDTO requestParam) {
       return shortLinkRemoteService.saveRecycle(requestParam);

    }

    /*分页查询短链接*/

    @GetMapping("/page")
    public Result<IPage<ShortLinkPageRespDTO>> pageShortLink(){
        return  recycleService.pageRecycleShortLink();

    }
    /*恢复*/
    @PostMapping("/recover")
    public Result<Void> recover(@RequestBody RecycleBinRecoverReqDTO requestParam) {
        return shortLinkRemoteService.recoverRecycle(requestParam);
    }
    /*移除*/
    @DeleteMapping("/remove")
    public Result<Void> remove(@RequestBody RecycleBinRemoveReqDTO requestParam) {
        return shortLinkRemoteService.removeRecycle(requestParam);
    }


}
